﻿
'Friend Class TokenMapping(Of TToken)
'    Private m_productionManager As ProductionManager

'    Public Sub New(ByVal productionManager As ProductionManager)
'        m_productionManager = productionManager
'    End Sub

'    Private m_currentStateIndex As Integer
'    Public Property CurrentStateIndex() As Integer
'        Get
'            Return m_currentStateIndex
'        End Get
'        Set(ByVal value As Integer)

'            Debug.Assert(value >= 0 AndAlso value < m_productionManager.TransitionTable.Count, _
'                         "The state index must be greater than 0 and less than the transition table size")

'            m_currentStateIndex = value
'        End Set
'    End Property

'    Public Function GetShift(ByVal token As IToken(Of TToken)) As LR1Shift
'        Dim currentState = m_productionManager.TransitionTable(m_currentStateIndex)

'        Dim shifts = currentState.Shifts

'        For Each shift In shifts
'            Dim terminal = TryCast(shift.LookAhead, TokenTerminal(Of TToken))

'            If terminal Is Nothing Then Continue For

'            If terminal.Match(token.TokenValue) Then
'                Return shift
'            End If
'        Next

'        'not found
'        Return Nothing
'    End Function

'    Public Function GetReduce(ByVal token As IToken(Of TToken)) As Reduce
'        Dim currentState = m_productionManager.TransitionTable(m_currentStateIndex)

'        Dim reduces = currentState.Reduces

'        For Each reduce In reduces
'            Dim terminal = TryCast(reduce.LookAhead, TokenTerminal(Of TToken))

'            If terminal Is Nothing Then Continue For

'            If terminal.Match(token.TokenValue) Then
'                Return reduce
'            End If
'        Next

'        'not found
'        Return Nothing
'    End Function
'End Class